/*
 * @(#)PropertiesUtil.java	Create on Mar 9, 2010 5:38:38 PM
 */

package com.glenet.salary.util;

import java.io.InputStream;
import java.util.Properties;

/**
 * @author meiwenhui
 * @email mwh.rzl@163.com
 * 
 */
public class PropertiesUtil {
	
	private static final Properties prop = loadPropertiesFile("salary.properties");

	private static Properties loadPropertiesFile(String filePath) {
		InputStream in;
		try {
			in = PropertiesUtil.class.getClassLoader().getResourceAsStream(filePath);
			Properties p = new Properties();
			p.load(in);
			return p;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	public static String getString(String key) {
		if (prop != null)
			return prop.getProperty(key);
		return null;
	}
	
	public static Double getDouble(String key) {
		double result = 0.00;
		if (prop != null)
			result = Double.parseDouble(prop.getProperty(key));
		return result;
	}
}
